#!/bin/bash

docker login --username=shangyekj registry.cn-hangzhou.aliyuncs.com --password  90-=uiop

result=$(docker ps -a |grep "cloud" )
if [[ "$result" != "" ]]
then
echo "执行 删除容器 的操作"
docker rm -f cloud-gateway cloud-system cloud-auth
fi


result1=$(docker images |grep "cloud-gateway" )
if [[ "$result1" != "" ]]
then
echo "执行删除旧镜像 拉取新镜像的操作"
docker rmi "registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-gateway:20201026" &

docker run -d --name cloud-gateway -p 6000:6000 registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-gateway:20201026 

else
docker run -d --name cloud-gateway -p 6000:6000 registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-gateway:20201026 	

fi



result2=$(docker images |grep "cloud-system" )
if [[ "$result2" != "" ]]
then
echo "执行删除旧镜像 拉取新镜像的操作"

docker rmi "registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-system:20201026" 
docker run -d --name cloud-system -P registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-system:20201026 

else
docker run -d --name cloud-system -P registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-system:20201026 

fi	




result3=$(docker images |grep "cloud-auth" )
if [[ "$result3" != "" ]]
then
echo "执行删除旧镜像 拉取新镜像的操作"
docker rmi "registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-auth:20201026"
docker run -d --name cloud-auth -P registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-auth:20201026 
else
docker run -d --name cloud-auth -P registry.cn-hangzhou.aliyuncs.com/sykj_docker_iso/cloud-auth:20201026 
fi









